package com.yonyou.handler;

import com.yonyou.entity.ResultEntity;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by WangXin on 2017/5/23.
 */
public class InitEntity {

    public List<ResultEntity> initResultEntity(String path) throws IOException {
        ExcelHandler excelHandler = new ExcelHandler();
//        List<List<String>> lists = excelHandler.readXlsx("H:\\下载\\rm_conconfirm.xlsx");
        List<List<String>> lists = excelHandler.readXlsx(path);

        List<ResultEntity> resultEntityList = new ArrayList<ResultEntity>();

        for (int k = 0;k<lists.size()-1;k++) {
            ResultEntity entity = new ResultEntity();
            for (int i = 0; i < lists.get(k).size(); i++) {
                switch (i) {
                    case 0:
                        entity.setIndex(k);
                        break;
                    case 1:
                        entity.setPk_contractconfirm(lists.get(k).get(i));
                        break;
                    case 2:
                        entity.setPk_corp(lists.get(k).get(i));
                        break;
                    case 3:
                        entity.setVbillno(lists.get(k).get(i));
                        break;
                    case 4:
                        entity.setDutyname(lists.get(k).get(i));
                        break;
                    case 5:
                        entity.setContracttype(lists.get(k).get(i));
                        break;
                    case 6:
                        entity.setContractconfirmmny(lists.get(k).get(i));
                        break;
                    case 7:
                        entity.setDbilldate(lists.get(k).get(i));
                        break;
                    case 8:
                        entity.setPk_billtype(lists.get(k).get(i));
                        break;
                    case 9:
                        entity.setVbillstatus(lists.get(k).get(i));
                        break;
                    case 10:
                        entity.setCustomsubprojectno(lists.get(k).get(i));
                        break;
                    case 11:
                        entity.setAcceptorg(lists.get(k).get(i));
                        break;
                    case 12:
                        entity.setAcceptdept(lists.get(k).get(i));
                        break;
                    case 13:
                        entity.setStarttime(lists.get(k).get(i));
                        break;
                    case 14:
                        entity.setEndtime(lists.get(k).get(i));
                        break;
                    case 15:
                        entity.setVoperatorid(lists.get(k).get(i));
                        break;
                    case 16:
                        entity.setDmakedat(lists.get(k).get(i));
                        break;
                    case 17:
                        entity.setVmodifierid(lists.get(k).get(i));
                        break;
                    case 18:
                        entity.setDmodifydate(lists.get(k).get(i));
                        break;
                    case 19:
                        entity.setVapproveid(lists.get(k).get(i));
                        break;
                    case 20:
                        entity.setDapprovedate(lists.get(k).get(i));
                        break;
                    case 21:
                        entity.setVapprovenote(lists.get(k).get(i));
                        break;
                    case 22:
                        entity.setVmemo(lists.get(k).get(i));
                        break;
                    case 23:
                        entity.setDef1(lists.get(k).get(i));
                        break;
                    case 24:
                        entity.setDef2(lists.get(k).get(i));
                        break;
                    case 25:
                        entity.setDef3(lists.get(k).get(i));
                        break;
                    case 26:
                        entity.setDef4(lists.get(k).get(i));
                        break;
                    case 27:
                        entity.setDef5(lists.get(k).get(i));
                        break;
                    case 28:
                        entity.setTs(lists.get(k).get(i));
                        break;
                    case 29:
                        entity.setDr(lists.get(k).get(i));
                        break;
                    default:
                        entity.setIsdiv(lists.get(k).get(i));
                        break;
                }
            }
            resultEntityList.add(entity);
        }

        return resultEntityList;

    }

}
